home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 11.0 KB | 355 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWCntrHW.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #if defined(FW_BUILD_WIN) && !defined(FWCNTRHW_H)
- #define FWCNTRHW_H
-
- #ifndef FWODTYPS_H
- #include "FWODTyps.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWRUNTYP_H
- #include "FWRunTyp.h"
- #endif
-
- // ----- Platform Includes -----
-
- #include <windows.h>
-
- //========================================================================================
- // Forward declarations
- //========================================================================================
-
- class FW_CControl;
- class FW_CScrollBar;
- class FW_CButton;
- class FW_CPushButton;
- class FW_CRadioButton;
- class FW_CRadioCluster;
- class FW_CPlatformPoint;
- class FW_CString;
-
- //========================================================================================
- // Global declarations
- //========================================================================================
-
- extern WORD WM_ODFGETOBJECT;
-
- //========================================================================================
- // CLASS FW_SPrivWinSuperClassInfo
- //========================================================================================
-
- struct FW_SPrivWinSuperClassInfo
- {
- LPCSTR fClassName;
- LPCSTR fOldClassName;
- WNDPROC fWndProc;
- WNDPROC fOldWndProc;
- WORD fWndExtraBytes;
- };
-
- //========================================================================================
- // CLASS FW_CPrivWinControlHelper
- //========================================================================================
-
- class FW_CPrivWinControlHelper
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Initialization/destruction
- //
- public:
- FW_CPrivWinControlHelper(Environment* ev, const FW_CClassInfo& classInfo, FW_CControl* control);
- virtual ~FW_CPrivWinControlHelper();
-
- void CheckForInitialize(Environment* ev, const FW_CClassInfo& classInfo);
- virtual void Initialize(Environment* ev);
-
- //----------------------------------------------------------------------------------------
- // Window manipulation
- //
- public:
- static FW_CPrivWinControlHelper* HWNDToHelper(HWND hWnd);
-
- void Move(const FW_CPlatformPoint& location,
- const FW_CPlatformPoint& size);
-
- void SetText(const FW_CString& text);
- void GetText(FW_CString& text) const;
-
- protected:
- FW_Boolean RegisterSuperClass(FW_SPrivWinSuperClassInfo& superClassInfo);
- virtual FW_SPrivWinSuperClassInfo&
- GetSuperClassInfo() const = 0;
- virtual HWND CreateHWnd(HWND parent,
- const FW_CPlatformPoint& location,
- const FW_CPlatformPoint& size) = 0;
-
- //----------------------------------------------------------------------------------------
- // Accessors
- //
- public:
- FW_CControl* GetControl() const;
-
- protected:
- FW_CControl* fControl;
- HWND fHWnd;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinControlHelper::GetControl
- //----------------------------------------------------------------------------------------
-
- inline FW_CControl* FW_CPrivWinControlHelper::GetControl() const
- {
- return fControl;
- }
-
- //========================================================================================
- // CLASS FW_CPrivWinScrollBarHelper
- //========================================================================================
-
- class FW_CPrivWinScrollBarHelper : public FW_CPrivWinControlHelper
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Initialization/destruction
- //
- public:
- FW_CPrivWinScrollBarHelper(Environment* ev, const FW_CClassInfo& classInfo, FW_CScrollBar* scrollBar);
- virtual ~FW_CPrivWinScrollBarHelper();
-
- virtual void Initialize(Environment* ev);
-
- //----------------------------------------------------------------------------------------
- // Scrolling
- //
- public:
- void HandleScrollMessage(WORD sbCode, WORD currentPosition);
-
- //----------------------------------------------------------------------------------------
- // Window manipulation
- //
-
- protected:
- virtual FW_SPrivWinSuperClassInfo& GetSuperClassInfo() const;
- virtual HWND CreateHWnd(HWND parent,
- const FW_CPlatformPoint& location,
- const FW_CPlatformPoint& size);
-
- //----------------------------------------------------------------------------------------
- // Windows message handling
- //
- public:
- static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg,
- WPARAM wParam, LPARAM lParam);
-
- //----------------------------------------------------------------------------------------
- // Windows scroll bar attribute accessors
- //
- public:
- int GetScrollPos() const;
- void SetScrollPos(int position);
-
- void GetScrollRange(int& minPosition, int& maxPosition) const;
- void SetScrollRange(int minPosition, int maxPosition);
-
- private:
- static FW_SPrivWinSuperClassInfo fgSuperClassInfo;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinScrollBarHelper::GetScrollPos
- //----------------------------------------------------------------------------------------
-
- inline int FW_CPrivWinScrollBarHelper::GetScrollPos() const
- {
- return fHWnd ? ::GetScrollPos(fHWnd, SB_CTL) : 0;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinScrollBarHelper::SetScrollPos
- //----------------------------------------------------------------------------------------
-
- inline void FW_CPrivWinScrollBarHelper::SetScrollPos(int position)
- {
- if (fHWnd)
- ::SetScrollPos(fHWnd, SB_CTL, position, TRUE);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinScrollBarHelper::GetScrollRange
- //----------------------------------------------------------------------------------------
-
- inline void FW_CPrivWinScrollBarHelper::GetScrollRange(int& minPosition,
- int& maxPosition) const
- {
- if (fHWnd)
- ::GetScrollRange(fHWnd, SB_CTL, &minPosition, &maxPosition);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinScrollBarHelper::SetScrollRange
- //----------------------------------------------------------------------------------------
-
- inline void FW_CPrivWinScrollBarHelper::SetScrollRange(int minPosition, int maxPosition)
- {
- if (fHWnd)
- ::SetScrollRange(fHWnd, SB_CTL, minPosition, maxPosition, TRUE);
- }
-
- //========================================================================================
- // CLASS FW_CPrivWinButtonHelper
- //========================================================================================
-
- class FW_CPrivWinButtonHelper : public FW_CPrivWinControlHelper
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Initialization/destruction
- //
- public:
- FW_CPrivWinButtonHelper(Environment* ev, const FW_CClassInfo& classInfo, FW_CButton* button);
- virtual ~FW_CPrivWinButtonHelper();
-
- //----------------------------------------------------------------------------------------
- // Window manipulation
- //
-
- protected:
- virtual FW_SPrivWinSuperClassInfo& GetSuperClassInfo() const;
- static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg,
- WPARAM wParam, LPARAM lParam);
-
- public:
- LRESULT GetState() const;
- void SetState(WPARAM state);
-
- //----------------------------------------------------------------------------------------
- // Windows message handling
- //
- public:
- virtual void HandleButtonMessage() = 0;
-
- private:
- static FW_SPrivWinSuperClassInfo fgSuperClassInfo;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinButtonHelper::GetState
- //----------------------------------------------------------------------------------------
-
- inline LRESULT FW_CPrivWinButtonHelper::GetState() const
- {
- return ::SendMessage(fHWnd, BM_GETSTATE, 0, 0L);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivWinButtonHelper::SetState
- //----------------------------------------------------------------------------------------
-
- inline void FW_CPrivWinButtonHelper::SetState(WPARAM state)
- {
- ::SendMessage(fHWnd, BM_SETCHECK, 0, 0L);
- }
-
- //========================================================================================
- // CLASS FW_CPrivWinPushButtonHelper
- //========================================================================================
-
- class FW_CPrivWinPushButtonHelper : public FW_CPrivWinButtonHelper
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Initialization/destruction
- //
- public:
- FW_CPrivWinPushButtonHelper(Environment* ev, const FW_CClassInfo& classInfo, FW_CPushButton* button);
- virtual ~FW_CPrivWinPushButtonHelper();
-
- virtual HWND CreateHWnd(HWND parent,
- const FW_CPlatformPoint& location,
- const FW_CPlatformPoint& size);
-
- void MakeDefaultButton(FW_Boolean isDefault);
-
-
- //----------------------------------------------------------------------------------------
- // Windows message handling
- //
- public:
- virtual void HandleButtonMessage();
- };
-
- //========================================================================================
- // CLASS FW_CPrivWinRadioButtonHelper
- //========================================================================================
-
- class FW_CPrivWinRadioButtonHelper : public FW_CPrivWinButtonHelper
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Initialization/destruction
- //
- public:
- FW_CPrivWinRadioButtonHelper(Environment* ev, const FW_CClassInfo& classInfo, FW_CRadioButton* button);
- virtual ~FW_CPrivWinRadioButtonHelper();
-
- virtual HWND CreateHWnd(HWND parent,
- const FW_CPlatformPoint& location,
- const FW_CPlatformPoint& size);
-
- //----------------------------------------------------------------------------------------
- // Windows message handling
- //
- public:
- virtual void HandleButtonMessage();
- };
-
- //========================================================================================
- // CLASS FW_CPrivWinRadioClusterHelper
- //========================================================================================
-
- class FW_CPrivWinRadioClusterHelper : public FW_CPrivWinButtonHelper
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Initialization/destruction
- //
- public:
- FW_CPrivWinRadioClusterHelper(Environment* ev, const FW_CClassInfo& classInfo, FW_CRadioButton* button);
- virtual ~FW_CPrivWinRadioClusterHelper();
-
- virtual HWND CreateHWnd(HWND parent,
- const FW_CPlatformPoint& location,
- const FW_CPlatformPoint& size);
-
- //----------------------------------------------------------------------------------------
- // Windows message handling
- //
- public:
- virtual void HandleButtonMessage();
- };
-
- #endif
-